import {Component, OnInit} from '@angular/core';
import {AdminService} from "../../../../services/admin.service";
import {AlertService} from "../../../../services/alert.service";
import {Loginlog} from "../../../../model/Loginlog";

@Component({
  selector: 'app-yhdlrz',
  templateUrl: './yhdlrz.component.html',
  styleUrls: ['./yhdlrz.component.css']
})
export class YhdlrzComponent implements OnInit {
  ls: Array<Loginlog>

  constructor(private adminService: AdminService,
              private alertService: AlertService) {
    this.ls = new Array<Loginlog>()
  }

  ngOnInit(): void {
    this.getLoginlogs()
  }

  getLoginlogs() {
    this.adminService.getLoginlogs().then((data: any) => {
      if (data.msg == "ok") {
        this.ls = data.list
      } else {
        this.alertService.showError("查询登陆日志失败")
      }
    })
  }
}
